<?php

use Illuminate\Support\Facades\Route;

Route::group(['prefix' => 'api', 'namespace' => 'API'], function () {

    Route::post('common/upload', 'CommonAPIController@upload');
    Route::get('common/get-workflow-phases', 'CommonAPIController@getWorkflowPhases');

    Route::post('auth/applicant-register', 'AuthAPIController@applicantRegister');
    Route::post('auth/user-login', 'AuthAPIController@userLogin');
    Route::post('auth/change-password', 'AuthAPIController@changePassword');
    Route::post('auth/admin-change-password', 'AuthAPIController@adminChangeUserPassword');
    Route::post('auth/get-certifying-org-user', 'AuthAPIController@getCertifyingOrgUsers');
    Route::post('auth/change-org-user-certify-status', 'AuthAPIController@changeOrgUsersCertifyStatus');
    Route::post('auth/delete-user', 'AuthAPIController@deleteUser');
    Route::post('auth/reupload-org-bizlic-Photo', 'AuthAPIController@reUploadOrgBizLicPhoto');

    Route::get('auth/get-applicant-users-page-data', 'AuthAPIController@getApplicantUsersPageData');
    Route::post('auth/edit-user-by-id', 'AuthAPIController@updateApplicantInfoById');

    Route::post('award/create-application', 'AwardAPIController@createApplication');
    Route::post('award/delete-application', 'AwardAPIController@deleteApplication');
    Route::post('award/save-form-data', 'AwardAPIController@saveFormData');
    Route::any('award/get-applications', 'AwardAPIController@getApplications');
    Route::any('award/get-nominators', 'AwardAPIController@getNominators');
    Route::post('award/applicant-submit-application-form', 'AwardAPIController@applicantSubmitApplicationForm');
    Route::post('award/nominator-agree-to-nominate', 'AwardAPIController@nominatorAgreeToNominate');
    Route::post('award/nominator-return-application', 'AwardAPIController@nominatorReturnApplication');
    Route::post('award/get-application-by-status', 'AwardAPIController@getApplicationsByStatusId');

    //形式审查
    Route::post('award/recall-application', 'AwardAPIController@recallApplication');
    Route::post('award/through-formal-review', 'AwardAPIController@applicationThroughFormalReview');
    Route::post('award/submit-expert-review', 'AwardAPIController@applicationSubmitExpertReview');

    //项目分组
    Route::post('award/create-award-group', 'AwardAPIController@createAwardGroup');
    Route::post('award/delete-award-group', 'AwardAPIController@deleteAwardGroup');
    Route::get('award/get-award-group-page-data', 'AwardAPIController@getAwardGroupsPageData');
    Route::post('award/get-add-group-award-info', 'AwardAPIController@getAddGroupAwardInfo');
    Route::post('award/get-selected-group-award-info', 'AwardAPIController@getSelectedGroupAwardInfo');
    Route::post('award/import-awards-to-award-group', 'AwardAPIController@importAwardsToAwardGroup');
    Route::post('award/delete-awards-in-award-group', 'AwardAPIController@deleteAwardsInAwardGroup');
    Route::post('award/update-award-group-basic-info-by-id', 'AwardAPIController@updateAwardBasicInfoById');

    //评审专家分组
    Route::post('auth/delete-expert-group', 'AuthAPIController@deleteExpertGroup');
    Route::get('auth/get-expert-group-page-data', 'AuthAPIController@getExpertGroupsPageData');
    Route::post('auth/get-add-group-expert-info', 'AuthAPIController@getAddGroupExpertInfo');
    Route::post('auth/get-selected-group-expert-info', 'AuthAPIController@getSelectedGroupExpertInfo');
    Route::post('auth/import-experts-to-expert-group', 'AuthAPIController@importExpertsToExpertGroup');
    Route::post('auth/delete-experts-in-expert-group', 'AuthAPIController@deleteExpertsInExpertGroup');

    //项目分组添加评审小组
    Route::post('award/get-award-group-add-expert-group-info', 'AwardAPIController@getAwardGroupAddExpertGroupInfo');
    Route::post('award/get-selected-expert-group-in-award-info', 'AwardAPIController@getAwardGroupSelectedExpertGroupInfo');
    Route::post('award/import-expert-groups-to-award-group', 'AwardAPIController@importExpertGroupsToAwardGroup');
    Route::post('award/delete-expert-groups-in-award-group', 'AwardAPIController@deleteExpertGroupsInAwardGroup');

    //分配项目到评审小组
    Route::post('award/allocate-award-to-expert-group', 'AwardAPIController@allocateAwardToExpertGroup');
    Route::post('award/get-award-group-review-arrangement-info', 'AwardAPIController@getAwardGroupReviewArrangementInfo');

    Route::any('award/get-awarded-projects', 'AwardAPIController@getAwardedProjects');

    //极验验证
    Route::any('/geetest/start-captcha', 'CommonAPIController@startCaptchaServlet');
    Route::any('/geetest/verify', 'DBAPICCommonAPIControllerontroller@verifyLoginServlet');
});

Route::get('logout', 'WebController@logout');

Route::get('apply', 'WebController@apply');
Route::get('apply/login', 'WebController@applyLogin');
Route::get('apply/register', 'WebController@applyRegister');
Route::get('nominate', 'WebController@nominate');
Route::get('nominate/login', 'WebController@nominateLogin');
Route::get('apply/show-print', 'WebController@showPrint');
Route::get('review', 'WebController@review');
Route::get('review/login', 'WebController@reviewLogin');
Route::get('meeting-review/login', 'WebController@meetingReviewLogin');

Route::get('home', 'WebController@home');
Route::get('home/apply', 'WebController@homeApply');
Route::get('home/nominate', 'WebController@homeNominate');
Route::get('home/review', 'WebController@homeReview');
Route::get('home/fill-form', 'WebController@homeFillForm');
Route::get('home/show-form-readonly', 'WebController@showFormInfoReadonly');
Route::get('home/view-form', 'WebController@viewForm');
Route::get('home/view-attachments', 'WebController@viewAttachments');
Route::get('home/won-awards', 'WebController@homeWonAwards');
Route::get('home/docs', 'WebController@homeDocs');
Route::get('home/contact-us', 'WebController@homeContactUs');

// Committee

Route::group(['prefix' => 'committee'], function () {
    Route::get('/', 'CommitteeWebController@index');
    Route::get('login', 'CommitteeWebController@login');
    Route::get('manage-large-group-expert-review', 'CommitteeWebController@manageLargeGroupExpertReview');
    Route::get('manage-large-group-meeting-review', 'CommitteeWebController@manageLargeGroupMeetingReview');
    Route::get('manage-large-group-vote', 'CommitteeWebController@manageLargeGroupVote');
    Route::get('manage-large-group-defense', 'CommitteeWebController@manageLargeGroupDefense');
    Route::get('manage-large-group-3', 'CommitteeWebController@manageLargeGroup3');
    Route::get('manage-large-group-5', 'CommitteeWebController@manageLargeGroup5');
    Route::get('manage-large-group-award', 'CommitteeWebController@manageLargeGroupAward');
    Route::get('vote-1', 'CommitteeWebController@vote1');
    Route::get('vote', 'CommitteeWebController@vote');

    Route::get('review', 'CommitteeWebController@review');
});

Route::group(['prefix' => 'api/committee'], function () {
    Route::any('get-manage-large-group-expert-review-data', 'CommitteeAPIController@getManageLargeGroupExpertReviewData');
    Route::any('leader-review-expert-review-result', 'CommitteeAPIController@leaderReviewExpertReviewResult');
    Route::any('submit-expert-review-result', 'CommitteeAPIController@submitExpertReviewResult');
    Route::any('get-manage-large-group-meeting-review-data', 'CommitteeAPIController@getManageLargeGroupMeetingReviewData');
    Route::any('leader-submit-meeting-review-result', 'CommitteeAPIController@leaderSubmitMeetingReviewResult');
    Route::any('leader-submit-defense-result', 'CommitteeAPIController@leaderSubmitDefenseResult');
    Route::get('get-manage-large-group-2-data', 'CommitteeAPIController@getManageLargeGroup2Data');
    Route::get('get-manage-large-group-3-data', 'CommitteeAPIController@getManageLargeGroup3Data');
    Route::get('get-manage-large-group-vote-data', 'CommitteeAPIController@getManageLargeGroupVoteData');
    Route::get('get-manage-large-group-defense-data', 'CommitteeAPIController@getManageLargeGroupDefenseData');
    Route::get('get-manage-large-group-5-data', 'CommitteeAPIController@getManageLargeGroup5Data');
    Route::any('set-undetermined-interval', 'CommitteeAPIController@setUndeterminedInterval');
    Route::any('submit-set-undetermined-interval-result', 'CommitteeAPIController@submitSetUndeterminedIntervalResult');
    Route::any('submit-vote-1-result', 'CommitteeAPIController@submitVote1Result');
    Route::any('submit-vote-result', 'CommitteeAPIController@submitVoteResult');
    Route::any('get-vote-1-data', 'CommitteeAPIController@getVote1Data');
    Route::any('get-vote-data', 'CommitteeAPIController@getVoteData');
    Route::any('vote-1', 'CommitteeAPIController@vote1');
    Route::any('vote', 'CommitteeAPIController@vote');
    Route::any('vote-batch-agree', 'CommitteeAPIController@voteBatchAgree');
    Route::any('update-final-award-level', 'CommitteeAPIController@updateFinalAwardLevel');
    Route::any('submit-meeting-review-result', 'CommitteeAPIController@submitMeetingReviewResult');
    Route::any('update-defense-award-level', 'CommitteeAPIController@updateDefenseAwardLevel');

    Route::post('add-or-remove-meeting','CommitteeAPIController@addOrRemoveMeeting');
    Route::post('set-meeting-project-num','CommitteeAPIController@setMeetingProjectNumber');
    Route::post('set-meeting-rank','CommitteeAPIController@setMeetingRank');
    Route::post('set-awards-configure','CommitteeAPIController@setAwardsConfigure');

});

// Admin web

Route::group(['prefix' => 'admin'], function () {

    Route::get('/', 'AdminWebController@index');
    Route::get('login', 'AdminWebController@login');
    Route::get('list-projects', 'AdminWebController@listProjects');
    Route::get('assign-review', 'AdminWebController@assignReview');
    Route::get('expert-review', 'AdminWebController@expertReview');
    Route::get('meeting-review','AdminWebController@meetingReview');
    Route::get('plan-award', 'AdminWebController@planAward');
    Route::get('prepare-defense', 'AdminWebController@prepareDefense');
    Route::get('award', 'AdminWebController@award');
    Route::get('manage-project-groups', 'AdminWebController@manageProjectGroups');
    Route::get('manage-reviewer-groups', 'AdminWebController@manageReviewerGroups');
    Route::get('certify-orgs', 'AdminWebController@certifyOrgs');
    Route::get('manage-commissioners', 'AdminWebController@manageCommissioners');
    Route::get('manage-reviewers', 'AdminWebController@manageReviewers');
    Route::get('manage-applicants', 'AdminWebController@manageApplicants');
    Route::get('manage-feedbacks', 'AdminWebController@manageFeedbacks');
    Route::get('manage-login-error','AdminWebController@manageLoginError');

    Route::get('formal-review-waiting/{award_id}', 'WebController@adminFormalReviewWaitingForReview');
    Route::get('formal-review-passed', 'WebController@adminFormalReviewPassed');
    Route::get('waiting-for-expert-review', 'WebController@adminWaitingForExpertReview');


    //Route::get('storage-download-file', 'WebController@storageDownloadFile');
});

// Admin API
Route::group(['prefix' => 'api/admin'], function () {
    Route::any('get-aside-data', 'AdminAPIController@getAsideData');
    Route::any('get-projects', 'AdminAPIController@getProjects');
    Route::any('get-list-projects-page-data', 'AdminAPIController@getListProjectsPageData');
    Route::any('end-phase-formal-review', 'AdminAPIController@endPhaseFormalReview');
    Route::any('update-project-status', 'AdminAPIController@updateProjectStatus');
    Route::any('update-project-attrs', 'AdminAPIController@updateProjectAttrs');
    Route::any('project-formal-review-passed', 'AdminAPIController@projectFormalReviewPassed');
    Route::any('get-reviewers', 'AdminAPIController@getReviewers');
    Route::any('get-feedbacks', 'AdminAPIController@getFeedbacks');
    Route::any('get-manage-commissioner-page-data', 'AdminAPIController@getManageCommissionerPageData');
    Route::any('create-commissioner', 'AdminAPIController@createCommissioner');
    Route::any('update-commissioner', 'AdminAPIController@updateCommissioner');
    Route::any('delete-commissioner', 'AdminAPIController@deleteCommissioner');
    Route::any('create-reviewer', 'AdminAPIController@createReviewer');
    Route::any('create-reviewer-group', 'AdminAPIController@createReviewerGroup');
    Route::any('delete-reviewer-group', 'AdminAPIController@deleteReviewerGroup');
    Route::any('update-reviewer-group-keywords', 'AdminAPIController@updateReviewerGroupKeywords');
    Route::any('update-reviewer-can-attend-review', 'AdminAPIController@updateReviewerCanAttendReview');
    Route::any('auto-replace-reviewer', 'AdminAPIController@autoReplaceReviewer');
    Route::any('replace-reviewer', 'AdminAPIController@replaceReviewer');
    Route::any('get-candidate-reviewers', 'AdminAPIController@getCandidateReviewers');
    Route::any('get-reviewer-groups', 'AdminAPIController@getReviewerGroups');
    Route::any('assign-projects', 'AdminAPIController@assignProjects');
    Route::any('cancel-assign-projects', 'AdminAPIController@cancelAssignProjects');
    Route::any('submit-assign-projects', 'AdminAPIController@submitAssignProjects');
    Route::any('get-plan-award-page-data', 'AdminAPIController@getPlanAwardPageData');
    Route::any('get-prepare-defense-page-data', 'AdminAPIController@getPrepareDefensePageData');
    Route::any('update-candidate-defense-projects-status', 'AdminAPIController@updateCandidateDefenseProjectsStatus');
    Route::any('auto-set-award-level', 'AdminAPIController@autoSetAwardLevel');
    Route::any('update-planned-award-level', 'AdminAPIController@updatePlannedAwardLevel');
    Route::any('submit-plan-award-result', 'AdminAPIController@submitPlanAwardResult');
    Route::any('submit-prepare-defense-result', 'AdminAPIController@submitPrepareDefenseResult');
    Route::any('get-reviewer-progress', 'AdminAPIController@getReviewerProgress');
    Route::any('get-project-score-segments-at-expert-review', 'AdminAPIController@getProjectScoreSegmentsAtExpertReview');

    Route::any('get-login-error','AdminAPIController@getLoginError');
    Route::any('clear-login-error','AdminAPIController@clearErrorNum');
    Route::post('get-project-data','AdminAPIController@getProjectData');

    Route::post('excel-export','AdminAPIController@excelExport');
    Route::post('get-meeting-project','AdminAPIController@getMeetingProject');
    Route::post('update-declare-phase','AdminAPIController@updateDeclarePhase');
    Route::post('get-declare-phase','AdminAPIController@getDeclarePhase');

    Route::post('select-meeting-reviewer','AdminAPIController@selectMeetingReviewer');
    Route::post('get-meeting-reviewers','AdminAPIController@getMeetingReviewers');
    Route::post('del-meeting-reviewer','AdminAPIController@delMeetingReviewer');

});

Route::group(['prefix' => 'api/apply'],function () {
    Route::any('update-project-attrs', 'ApplyAPIController@updateProjectAttrs');
});

// Review Web
Route::group(['prefix' => 'review'], function () {
    Route::get('list-projects', 'ReviewWebController@listProjects');
    Route::get('award-manage-method', 'ReviewWebController@awardManageMethod');
    Route::get('review-workflow', 'ReviewWebController@reviewWorkflow');
    Route::get('feedback', 'ReviewWebController@feedback');
    Route::get('contact-us', 'ReviewWebController@contactUs');
    Route::get('score', 'ReviewWebController@score');
});

// Review API
Route::group(['prefix' => 'api/review'], function () {
    Route::any('get-projects', 'ReviewAPIController@getProjects');
    Route::any('get-project-score', 'ReviewAPIController@getProjectScore');
    Route::any('save-project-score', 'ReviewAPIController@saveProjectScore');
    Route::any('submit-project-score', 'ReviewAPIController@submitProjectScore');
    Route::any('submit-feedback', 'ReviewAPIController@submitFeedback');
    Route::any('report-welcome-dialog-shown', 'ReviewAPIController@reportWelcomeDialogShown');
});

// MeetingReview Web
Route::group(['prefix' => 'meeting-review'], function () {
    Route::get('list-projects', 'MeetingReviewWebController@listProjects');
});

// MeetingReview API
Route::group(['prefix' => 'api/meeting-review'], function() {
    Route::any('get-projects', 'MeetingReviewAPIController@getProjects');
});

Route::get('defense/list-projects', 'DefenseReviewWebController@listProjects');
Route::get('api/defense/get-projects', 'DefenseReviewAPIController@getProjects');

Route::get('review/review', 'WebController@reviewWaitingForReview');
Route::get('review/my-group', 'WebController@reviewMyGroup');

require_once __DIR__.'/test.php';

Route::get('/', [
    'uses' => 'WebController@index',
    'as' => 'login',
]);

Route::get('progress/score-table', function () {
    return view('progress-score-table');
});

Route::group(['prefix' => 'api/db', 'namespace' => 'API'], function () {
    Route::any('get', 'DBAPIController@get');
    Route::any('create', 'DBAPIController@create');
    Route::any('update', 'DBAPIController@update');
    Route::any('delete', 'DBAPIController@delete');
});



Route::group(['prefix' => 'menu-set'], function () {
    Route::any('index','MenusController@index');

    /**
     * API请求路由
     * @start
     */
    Route::any('get-list', 'MenusController@getList');
    Route::any('get-primary', 'MenusController@getPrimary');
    Route::any('update-status', 'MenusController@updateStatus');
    Route::any('delete', 'MenusController@delete');
    Route::any('save', 'MenusController@save');
    /**
     * API请求路由
     * @end
     */
});


Route::group(['prefix' => 'role-set'], function () {
    Route::any('index','RolesController@index');
    Route::any('manage', 'RolesController@manage');

    /**
     * API请求路由
     * @start
     */
    Route::any('get-list', 'RolesController@getList');
    Route::any('menus-tree', 'MenusController@menusTree');
    Route::any('update-status', 'RolesController@updateStatus');
    Route::any('delete', 'RolesController@delete');
    Route::any('save', 'RolesController@save');
    Route::any('manage-save', 'RolesController@manageSave');

    Route::any('delete-manage','RolesController@deleteManage');
    Route::any('update-manage-status', 'RolesController@updateManageStatus');
    Route::any('get-manage-list', 'RolesController@getManageList');
    /**
     * API请求路由
     * @end
     */
});


//Route::get('test', function (){
//    $Server = new \App\Services\UserAddressExportService();
//    $Server->ReadExcelInfo();
//});

